home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 40 / Amiga Format CD40 (1999-05-11)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-06].iso / -readerstuff- / steve_turner / canal / routes / canal.doc < prev    next >
Text File  |  1999-03-29  |  20KB  |  377 lines

  1. ****************************************************************************
  2. *                  CANAL CALCULATOR BY STEVE TURNER (c) 1998               *
  3. ****************************************************************************
  4.  
  5. I use hire canal boats and needed to ensure that I could get to the locations 
  6. I desired and return the boat on time. I also wanted to try and stop at 
  7. interesting locations for lunch and for the night (i.e. by a pub!). So I sat 
  8. down with the appropriate Nicholson guide and tried to work out an 
  9. itinerary. If, like me, you have tried that you will know how hard this simple 
  10. task is. How far is it? How fast do I travel? How long to do a lock? With a 
  11. little experience you soon learn this but it takes ages working out distances 
  12. and times. After a couple of hours work you find your half a day short. 
  13. What if I start half an hour earlier each morning you think? Oh No! I'm not 
  14. working all that out again!
  15.  
  16. Well as you've already guessed this is the answer to your prayers. I first 
  17. wrote this program in 'C' on a 1.3 version Amiga. When I upgraded to 
  18. V2.04 it didn't seem to work correctly and whilst the source code was well 
  19. documented, finding this bug was almost impossible. In addition, after using 
  20. the program a few times I found I wanted a few more facilities. About the 
  21. same time I got a cheap version of Blitz Basic. Within days I had registered 
  22. for the full version and had decided to rewrite the canal calculator as my 
  23. introduction.
  24.  
  25. By 1998 my increasing dissatisfaction with the user interface was finally 
  26. brought to a head when Erwan Fouret introduced his MUI Library for Blitz. 
  27. So late into the night over June, July and August I converted 'Canal_Calc' 
  28. into an MUI version and dropped the old one. I also took this opportunity to 
  29. improve the program and increase it's useability. 
  30.  
  31. Whilst Blitz2 runs very fast the extremely complicated search algorithm is a 
  32. bit slow. However, I'm getting ahead of myself. Here is a full description of 
  33. the program using the menus as the headings. The menus are described as 
  34. they appear and not in the order you would use them. Note therefore that 
  35. you need to have a map loaded or created before most of the menu items 
  36. can be used. One other point is that the program will not complain if you 
  37. load an unmatched map and route but it may get confused. I take no 
  38. responsibility for the outcome if you do this.
  39.  
  40. The search algorithm is recursive and whilst I've given you a large stack you 
  41. may run into two problems;
  42. 1) If during a search you get a crash increase the stack (see Icon Info file 
  43. details)
  44. 2) If the program will not load due to lack of memory decrease the stack 
  45. size in the same way. Of course you may then get a crash due to the stack 
  46. being too small but don't let that stop you trying.
  47.  
  48. One other trick you may find useful to speed up a search is to;
  49. 1) Load the map.
  50. 2) Decide your route.
  51. 3) Edit the map by deleting every location next to a junction that you will 
  52. not be travelling through.
  53. 4) Do the route search.
  54. 5) Save the route.
  55. 6) Reload the correct map.
  56. Hey Presto! You have quickly created a route and still got the map intact. 
  57. However, in version 3.0 I have introduced a manual method of installing the 
  58. route. I now find this is actually the best way to do it!
  59.  
  60. PROJECT MENU
  61. ============
  62. NEW - (A)N
  63. This is straight forward. As you would expect, any Maps or Routes are 
  64. dumped from memory and you are ready to start a new project.
  65.  
  66. LOAD > MAP - (A)L
  67. Again, no surprises, load a previously saved map. I've included a couple of 
  68. maps (maybe more ) on the disk split up as Nicholson guides. They may not 
  69. be complete or have the places you need so you'll just have to amend them 
  70. or start your own!
  71.  
  72. LOAD > ROUTE - (A)K
  73. No route has been included on the disk so you need to create one. Then 
  74. you can use this menu item to reload it.
  75.  
  76. LOAD > V1.0 MAP
  77. There will not be many of you need this but it will load maps saved out of 
  78. the version one canal calculator. You probably deduced from this the two 
  79. map formats are different.
  80.  
  81. SAVE > MAP - (A)S
  82. Very simple again. Use this to save to any device a map from memory. This 
  83. is disabled in none registered version.
  84.  
  85. SAVE > ROUTE - (A)A
  86. Yes. Save a route from memory to any device. This is disabled in none 
  87. registered version.
  88.  
  89. CALCULATE - (A)C
  90. This is the hart of the program and must be used to create a 'route' before 
  91. any useful work can be done. For a route to be calculated a map must exist 
  92. in memory. If you use calculation the program will attempt to find the 
  93. shortest route between the start and end points you specify. In addition, it 
  94. will go via up to 10 locations given. Why have Via locations? Well to allow 
  95. you to force the program to follow a certain path. Now you may ask why 
  96. have the program to find the shortest route and then force it to go another 
  97. way? The answer to that is that you may want to go round a ring in a 
  98. certain direction. Alternatively, you may want to take the longest route or 
  99. detour up a branch. In any event the 10 via locations allow you more 
  100. control over the selected route. I have never used or needed more than 2 
  101. via locations but I hope 10 will cover anyone's needs. I can alter it for more 
  102. if necessary just let me know. As from V3.0 a requester has been inserted 
  103. and you can now decide to tell the program the list of locations from the 
  104. start to end location. When you select this option, the following events occur;
  105. 1) A request is made for a start location.
  106. 2) A request is made for an end location.
  107. 3) Up to 10 requests are made for via locations and any cancelled request 
  108. aborts any further requests.
  109. 4) A requester asks if you want to do it manually or automatically.
  110. 5a) AUTOMATIC 
  111. You now sit and wait for the route to be found. It's progress can be 
  112. monitored and from V3.0 it can be aborted. In version 2.01 I have speeded 
  113. up the code and have added a requester that will allow you to reduce the 
  114. screen output. The effect of this is to speed up the code by about 3 times. 
  115. What was a 15 min. search now takes 5 min. with the screen output turned 
  116. off. It still however gives you some indication of what is happening.
  117. 5b) MANUAL
  118. A new window will pop up and show you the start location and either the 
  119. end location or the first via location. The window will keep popping up until 
  120. all the via locations are done. The window will go away on it's own when 
  121. you find the end location but if you go wrong you can press the abort 
  122. button (that is a separate window and May be hidden) but you loose all the 
  123. work up to that point.
  124. In the centre of the window is the location you are currently 'at' above and 
  125. below are the locations in the various directions. This will mostly only be two 
  126. unless your at a junction. Decide the correct direction to travel and only then 
  127. press the appropriate direction button. This will cause the window to update 
  128. and now show this new location as the location you are 'at' and the whole 
  129. process repeats until you reach the end location. Whilst this May be a fair 
  130. amount of work for a long trip, it will probably be quicker than the 
  131. automatic system that searches every possible route and or direction.
  132.  
  133. PRINT - (A)P
  134. Now to the interesting bit. Print, outputs the details of your 'trip' to the 
  135. screen and/or printer. The output firstly prints out the settings; pick-up
  136. time; start time; stop time; lunch length; lock time; speed. Now, starting 30
  137. mins. from boat pick-up time the program calculates how long to get to the
  138. next location on your route. If the location is a lock, this time is also
  139. added to the time to travel between locations. This process is repeated for
  140. the next location and so on until the end location is reached. (You will of
  141. course normally be starting and ending at the same location.) If it is lunch
  142. time and you are at a 'preferred stop' the program will add in the time for
  143. lunch and indicate the time to cast off. Similarly, if the location is a
  144. preferred stop and it is your night stop time or later you will be told that
  145. this is your night stop and the morning start time will be used as cast off
  146. time the next day. If, within certain limits, no suitable 'preferred stop' is
  147. found for lunch or night time a forced stop will be made at any location. If a
  148. location is indicated as a 'stop over' then time is allowed at that location
  149. for the time stated in the setting and cast off time is indicated. 'Stop over'
  150. locations once visited are flagged and not stopped at again if you travel past
  151. or through a second time. You will find that you will want to print this to
  152. screen, inspect the stopping places and the time taken. Then 'tweak' the
  153. parameters, reprint and repeat until everything is just right. To help with
  154. this, from V3.0 the print out to screen is put into a lister so you can scroll
  155. back and forward inspecting the route. Finally, commit it to paper to take with
  156. you. At this point I must admit to the poor printing facilities provided within
  157. Blitz2. The printing is done to the simple default workbench printer file PRT:
  158. It is possible from Blitz2 to call the system libraries and I may improve
  159. printer output later if I get enough requests. Ensure your window is wide
  160. enough to see all the information because stops are added to the right of the
  161. text.
  162.  
  163. ABOUT
  164. Fairly simply a copyright notice and registration details.
  165.  
  166. ABOUT MUI
  167. Same again for MUI but a bit more detail
  168.  
  169. MUI PREFS
  170. You should know and have set the MUI prefs as you already use it but 
  171. calling it from the program allows you to adjust the prefs for just this 
  172. program.
  173.  
  174. QUIT - (A)Q
  175. No surprises here. The program will quit out warning you if you have an 
  176. unsaved map or route in memory.
  177.  
  178. EDIT MENU
  179. =========
  180.  
  181. EXTEND MAP - (A)M
  182. This is used to start a new map or to extend a previously loaded map. 
  183. Please note that this will not allow you to add locations into an existing 
  184. map, only extend it, (That is add to the edge). On selection a requester will 
  185. open for you to select the point from which the map is to be extended. If it 
  186. is a new map you will not get the requester and the extend map window 
  187. will open at location one.
  188. The extend map window at first looks complicated but it is very simple. A 
  189. brief description will help. First, the information. At the top of the window 
  190. is the location number. You have no control of this number that is used 
  191. internally and allocated by the system as needed. If you have two or more 
  192. locations with the same name only the one with the lowest location number 
  193. is found in a search so beware! At the bottom of the window the locations 
  194. in the four directions adjacent to this location are shown to help you move 
  195. about the map. Note that with limited space for the name it may be 
  196. truncated. Now to the business part of the window. Near the top is a string 
  197. requester for the location name. Any alpha-numeric string may be used but 
  198. avoid using the name of another location. If no name is entered the system 
  199. will allocate a default name. Under the name are two check mark buttons. 
  200. One for preferred stops and one for locks. A preferred stop will be used as a 
  201. stopping point for lunch or night time whenever possible. A non-preferred 
  202. stop will only be used if unavoidable. So select the location as a preferred 
  203. stop if it's near a pub or shops or in a town or village worth seeing. The 
  204. 'lock' button is fairly obvious in use but for the system to be accurate every 
  205. lock must be included with this button set so that travelling times can be 
  206. calculated. You will see below that a distance must be set between every 
  207. location but sometimes locks are so close together that they effectively have 
  208. no distance between them. To allow the system to cope, just show one tenth 
  209. of a mile between each lock regardless of how close they are. If they are 
  210. more than this then show the correct distance. For example, Foxton is two 
  211. sets of 5 locks in a staircase. This would be shown as 10 locations spanning 
  212. a total of one mile. In truth, the distance is probably less that a quarter 
  213. mile but if you've been up or down Foxton locks you will know the extra 
  214. time created by the distance is needed anyway. In the centre-ish are four 
  215. direction buttons. Once you have entered the name of the location and set 
  216. the 'lock' and 'stop' buttons according to need it is time to move on to the 
  217. next location. As the map is not a detailed record of the canal system only 
  218. four directions are used so pick the most appropriate. It actual fact, the 
  219. direction has no relevance whatsoever. It is used simply to help in use and 
  220. creation of the map. If you click on a direction that already has a location
  221. in that direction then you will be moved to that location. If however you click
  222. in an empty direction a small requester will appear to ask you the distance 
  223. to the new location. Enter the distance in miles (or more appropriately parts 
  224. of a mile) to the next location and press return. Note that the minimum 
  225. distance is 0.1 miles and the maximum is 5 miles. A distance of nil is no 
  226. connection and can not be accepted as an entry. After a valid distance has 
  227. been entered a new location is created and the proses is repeated. You have 
  228. two ways to end the map entry. 'Dump and exit' or 'save and exit'. It 
  229. should be obvious that dump will delete the current entry and it's 
  230. connections before exiting and save will exit and keep the current location. 
  231. Dump will remove the location even if it had previously been saved. This is 
  232. the only way to scrap a location from the map. If you are looking for a 
  233. 'delete location' menu item then you are out of luck. Select 'extend map', 
  234. pick the location to scrap and then do a 'dump and exit'. You will have to 
  235. confirm your selection in this case. The system will try to re-connect the 
  236. adjoining locations if at all possible but if it is unable to do so a warning 
  237. will be given and you will have to re-select 'extend map' and connect up 
  238. the gap. That brings us nicely to the last button in the window 'Connect To'. 
  239. This is used in place of a direction button when you want to connect this 
  240. location to a location already existing in the map. For example to close up a 
  241. circular route. On clicking this button you will be asked which direction to 
  242. connect in and the distance to the location and then the location to connect 
  243. to. You must select a valid direction. i.e. If you select north then this 
  244. location must have no existing north connection and the new location must 
  245. have no existing south connection. The maps provided with the program 
  246. will help you to see how all this works.
  247.  
  248. LOCATION NAME - (A)E
  249. Simple option to select a location and change it's name. As stated above, 
  250. avoid using the same location name for more than one location. Should you 
  251. give it no name at all, a default name will be created.
  252.  
  253. LOCATION DISTANCE - (A)D
  254. Same again, select a location and change the distance to another location.
  255.  
  256. INSERT LOCATION - (A)I
  257. Again not very complicated. First you are asked for a location to insert next 
  258. to. Then the direction in which it is to be inserted. Finally, the name for
  259. the new location. The new location is inserted mid-way between the two old
  260. locations. Use Edit>Location distance if you need to change the distances 
  261. and Edit>Extend map to make it a lock or preferred stop.
  262.  
  263. SET STOPS - (A)V
  264. There are places along your trip that you may want to stop at for a look 
  265. around. By setting the location as a stop the system will stop at this location
  266. regardless of the time of day for the period given. You select each location 
  267. required and are asked for the length of time (in minutes) to stay there. If a 
  268. selected location is arrived at during lunch, the stop time will be added to 
  269. the lunch time (Is this a bug or a feature?). The stops are stored in the map 
  270. but are not saved as part of the map. The stops are saved as part of the 
  271. route. If you start a new route the stops will remain in the map and be used 
  272. accordingly. It may be necessary therefore to delete the stops when a new 
  273. route is made on an existing map. The stop window will allow you to amend 
  274. or delete them.
  275. In Version 2.01+ the location will only be `stopped at' the first time you 
  276. pass through it. If you pass through the same location later, it will not 
  277. produce a stop.
  278.  
  279. DEFAULTS MENU
  280. =============
  281.  
  282. All the defaults are saved as part of the route. All the defaults except two 
  283. use the time requester that is a window with 2 sliders in it to represent a 
  284. 24hr. clock. 
  285.  
  286. PICK UP TIME - (A)T
  287. A time requester will appear for you to set the time you will pick up the 
  288. boat. Your trip will start 30mins. after this time.
  289.  
  290. MORNING START TIME - (A)B
  291. This is the time used for casting off each morning.
  292.  
  293. EVENING STOP TIME - (A)F
  294. If a preferred stop is found after this time it is used as the night stop 
  295. location. If a preferred stop is not found 30mins. beyond this time the next 
  296. location is used as the night stop regardless.
  297.  
  298. LENGTH OF LUNCH - (A)G
  299. Simply the length of lunch time required. If you do not intend to stop for 
  300. lunch set this to zero.
  301.  
  302. SPEED ON WATER - (A)W
  303. This simple requester allows setting your speed along open canal up and 
  304. down. I find that 2.5 m.p.h. is a good average. On canals with few locks the 
  305. average goes up and with many locks or difficult flows it can come down.
  306.  
  307. TIME TO DO LOCK - (A)U
  308. Again simply the time taken to do a lock. Many factors affect the time to 
  309. work up or down a lock. Size (physical and quantity) of the crew, size of 
  310. lock and rate of fill/empty, amount of other boats using the lock etc. I tend 
  311. to use 10 mins. per lock. On big flights like Hatton you often share the 
  312. work and can pass other boats without trouble. On smaller flights you have 
  313. quicker time for emptying and filling and less hold ups. I have been up to 
  314. an hour out it the time to do a flight of locks due to waiting but you can 
  315. make it up without too much trouble. If you have a crew of one + captain 
  316. then use longer lock times but others wise 10 to 12 minutes shouldn't be 
  317. far out. Keeping a log of your trips will help to indicate your average times.
  318.  
  319. START DAY > SAT. - (A)1
  320.      .........
  321.       FRI. - (A)7
  322. I'll let you guess what this does.
  323.  
  324. Well that's it. I hope the above details are informative and the program is 
  325. useful. I couldn't take the Guides on holiday without it, particularly as we 
  326. have to arrive at change over points within an hour of the time given to the 
  327. parents. Arriving early is O.K. but being late makes them anxious.
  328.  
  329. FEB. 1995
  330.  
  331. Version 2.01 - Updated 8/6/96 with speed and `set stop' enhancements.
  332.  
  333. Version 2.1 - JULY 1997 - Made windows font sensitive.
  334.  
  335. Version 3.0 - AUGUST 1998 - Made Program MUI Dependant. Improved a 
  336. few of the sub routines in doing so. Added Abort button to Calculation. 
  337. Added Manual entry of route.
  338.  
  339. Version 3.1 - FEBRUARY 1999 - Fixed bug and improved automatic search 
  340. algorithm. Also fixed bug in Route Load that caused 'stops' not to be loaded.
  341. Added option to print to file.
  342.  
  343. STEVE TURNER
  344. 21 OXFORD CLOSE
  345. WASHINGBOROUGH
  346. LN4 1DT.
  347.  
  348. Bye!
  349.  
  350. ------------------------------------------------------------------------
  351.            MUI - MagicUserInterface
  352.          (c) Copyright 1992-97, Stefan Stuntz
  353. ------------------------------------------------------------------------
  354.  
  355. MUI is an object oriented system to create and maintain graphical user 
  356. interfaces. From a programmers point of view, using MUI saves a lot of 
  357. time and makes life much easier. Thinking about complicated terms like 
  358. window resizing or font sensitivity is simply not necessary.
  359.  
  360. On the other hand, users of MUI based applications have the ability to 
  361. customize nearly every pixel of a programs interface according to their 
  362. personal taste.
  363.  
  364. ------------------------------------------------------------------------
  365.  
  366. Blitz Basic is a cross between a standard basic language and 'C'.
  367.  
  368. I strongly recommend anyone with programming experience to have a look at it.
  369. Blitz is a fast compiled language with low level access.
  370.  
  371. Blitz is copyright 1993 by Acid Software, a division of Armstrong
  372. Communications Limited New Zealand and was developed by Mark Sibly.
  373.  
  374. Acid Fax= 64-9-358-1658      \
  375.                               }- Now not Valid ?
  376. UK Phone/Fax= 0171 482 4066  /
  377.